//
// RTL: Input groups
// --------------------------------------------------

.input-sm {
  .input-size(@input-height-small; @padding-small-vertical; @padding-small-horizontal; @font-size-small; @line-height-small; @border-radius-small);
}

.input-lg {
  .input-size(@input-height-large; @padding-large-vertical; @padding-large-horizontal; @font-size-large; @line-height-large; @border-radius-large);
}

// Sizing options
//
// Remix the default form control sizing classes into new ones for easier
// manipulation.

.input-group-lg > .form-control,
.input-group-lg > .input-group-addon,
.input-group-lg > .input-group-btn > .btn { .input-lg(); }
.input-group-sm > .form-control,
.input-group-sm > .input-group-addon,
.input-group-sm > .input-group-btn > .btn { .input-sm(); }


// Text input groups
// -------------------------
.input-group-addon {
  border: 1px solid @input-group-addon-border-color;
  border-radius: @border-radius-base;

  // Sizing
  &.input-sm {
    border-radius: @border-radius-small;
  }
  &.input-lg {
    border-radius: @border-radius-large;
  }
}

// Reset rounded corners
.input-group .form-control:first-child,
.input-group-addon:first-child,
.input-group-btn:first-child > .btn,
.input-group-btn:first-child > .btn-group > .btn,
.input-group-btn:first-child > .dropdown-toggle,
.input-group-btn:last-child > .btn:not(:last-child):not(.dropdown-toggle),
.input-group-btn:last-child > .btn-group:not(:last-child) > .btn {
  border-radius: @border-radius-base;
  .border-left-radius(0);

  // Sizing
  &.input-sm {
    border-radius: @border-radius-small;
    .border-left-radius(0);
  }
  &.input-lg {
    border-radius: @border-radius-large;
    .border-left-radius(0);
  }
}
.input-group-addon:first-child {
  border-left: 0;
}
.input-group .form-control:last-child,
.input-group-addon:last-child,
.input-group-btn:last-child > .btn,
.input-group-btn:last-child > .btn-group > .btn,
.input-group-btn:last-child > .dropdown-toggle,
.input-group-btn:first-child > .btn:not(:first-child),
.input-group-btn:first-child > .btn-group:not(:first-child) > .btn {
  border-radius: @border-radius-base;
  .border-right-radius(0);

  // Sizing
  &.input-sm {
    border-radius: @border-radius-small;
    .border-right-radius(0);
  }
  &.input-lg {
    border-radius: @border-radius-large;
    .border-right-radius(0);
  }
}
.input-group-addon:last-child {
  border-right: 0;
}

// Button input groups
// -------------------------
.input-group-btn {
  > .btn {
    position: relative;
    + .btn {
      margin-left: 0;
      margin-right: -1px;
    }
  }

  // Negative margin to only have a 1px border between the two
  &:first-child {
    > .btn,
    > .btn-group {
      margin-left: -1px;
      margin-right: 0;
    }
  }
  &:last-child {
    > .btn,
    > .btn-group {
      margin-left: 0;
      margin-right: -1px;
    }
  }
}


// Remove double borders
.input-group > .input-group-btn + input {
  margin-left: 0;
  margin-right: -1px;
}

.input-group > input + .input-group-btn .btn:first-child {
  border-left-width: 1px;
  border-right-width: 0;
}
